home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / StatusMonitor / UViewStatusInfo.h < prev   
Encoding:
C/C++ Source or Header  |  1995-07-28  |  9.5 KB  |  360 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        UViewStatusInfo.h
  3.  
  4.     Contains:    *** put contents here ***
  5.  
  6.     Written by:    Steve Datnow
  7.  
  8.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         8/24/93        SLD        Add Bullet text
  13.         8/18/93        SLD        Add FixedPopup
  14.         4/2/93      KSS        Add new status items.
  15.         1/21/92     SLD        *** put comment here ***
  16.  
  17.     To Do:
  18. */
  19.  
  20. #ifndef __UViewStatusInfo__
  21. #define __UViewStatusInfo__
  22.  
  23. #ifndef __PACKAGES__
  24. #include <Packages.h>
  25. #endif
  26.  
  27. #ifndef __UDIALOG__
  28. #include <UDialog.h>
  29. #endif
  30.  
  31. #ifndef __UGRIDVIEW__
  32. #include <UGridView.h>
  33. #endif
  34.  
  35. #ifndef __UVIEW__
  36. #include <UView.h>
  37. #endif
  38.  
  39. // Forward and external classes (see Types.h for PascalObj macro)
  40. //----------------------------------------------------------------------------------------
  41.  
  42. class PascalObj TDocumentSecondStomach;
  43. class PascalObj TStream;
  44.  
  45. /***********************************|****************************************/
  46.  
  47. //----------------------------------------------------------------------------------------
  48. // TViewStatusInfo
  49. //----------------------------------------------------------------------------------------
  50.  
  51. class TViewMonitorStaticText : public TStaticText
  52. {
  53. public:                            TViewMonitorStaticText();
  54.  
  55.         virtual pascal void IViewMonitorStaticText(TView* itsSuperView,
  56.                                     const VPoint& itsLocation,
  57.                                     const VPoint& itsSize,
  58.                                     SizeDeterminer itsHSizeDet,
  59.                                     SizeDeterminer itsVSizeDet,
  60.                                     ResNumber itsRsrcID,
  61.                                     short itsIndex);
  62.         // Initialize the static text field procedurally.
  63.         
  64.         virtual pascal void     GetText(CStr255& theText);
  65. };
  66.  
  67. /***********************************|****************************************/
  68.  
  69. class TViewMonitorStatus: public TViewMonitorStaticText
  70. {
  71.     virtual pascal void Initialize();
  72.     
  73.                                  
  74.     virtual pascal void SuperViewChangedFrame(const VRect& oldFrame,
  75.                                          const VRect& newFrame,
  76.                                          Boolean invalidate);
  77.     public :
  78.     virtual  pascal void SetText(const CStr255& theText,
  79.                                  Boolean redraw);
  80.  
  81.     virtual pascal void BlinkText();
  82.     
  83.     protected:
  84.         CStr255 fOldText;
  85.         unsigned long fBlinkStatusTimer;
  86. };
  87.  
  88. /***********************************|****************************************/
  89.  
  90. class TViewNumStatusInfo: public TViewMonitorStaticText
  91. {
  92.     virtual pascal void DoUpdate(ChangeID theChange, 
  93.                               TObject* changedObject,
  94.                               TObject* changedBy,
  95.                               TDependencySpace* dependencySpace);
  96. };
  97.  
  98. /***********************************|****************************************/
  99.  
  100. class TViewNumKilobytesStatusInfo: public TViewMonitorStaticText
  101. {
  102.     virtual pascal void DoUpdate(ChangeID theChange, 
  103.                               TObject* changedObject,
  104.                               TObject* changedBy,
  105.                               TDependencySpace* dependencySpace);
  106. };
  107.  
  108.  
  109. /***********************************|****************************************/
  110.  
  111. class TViewNumBytesStatusInfo: public TViewMonitorStaticText
  112. {
  113.     virtual pascal void DoUpdate(ChangeID theChange, 
  114.                               TObject* changedObject,
  115.                               TObject* changedBy,
  116.                               TDependencySpace* dependencySpace);
  117. };
  118.  
  119. /***********************************|****************************************/
  120.  
  121. class TViewStrStatusInfo: public TViewMonitorStaticText
  122. {
  123.     virtual pascal void DoUpdate(ChangeID theChange, 
  124.                               TObject* changedObject,
  125.                               TObject* changedBy,
  126.                               TDependencySpace* dependencySpace);
  127. };
  128.  
  129. /***********************************|****************************************/
  130.  
  131. class TViewTimeStatusInfo: public TViewMonitorStaticText
  132. {
  133.     virtual pascal void DoUpdate(ChangeID theChange, 
  134.                               TObject* changedObject,
  135.                               TObject* changedBy,
  136.                               TDependencySpace* dependencySpace);
  137. };
  138.  
  139. /***********************************|****************************************/
  140.  
  141. class TViewTimeStatusWithSecondsInfo: public TViewMonitorStaticText
  142. {
  143.     virtual pascal void DoUpdate(ChangeID theChange, 
  144.                               TObject* changedObject,
  145.                               TObject* changedBy,
  146.                               TDependencySpace* dependencySpace);
  147. };
  148.  
  149. /***********************************|****************************************/
  150.  
  151. class TViewElaspedTimeStatusInfo: public TViewMonitorStaticText
  152. {
  153.     virtual pascal void DoUpdate(ChangeID theChange, 
  154.                               TObject* changedObject,
  155.                               TObject* changedBy,
  156.                               TDependencySpace* dependencySpace);
  157. };
  158.  
  159. /***********************************|****************************************/
  160.  
  161. class TViewElaspedTimeWithSecondsStatusInfo: public TViewMonitorStaticText
  162. {
  163.     virtual pascal void DoUpdate(ChangeID theChange, 
  164.                               TObject* changedObject,
  165.                               TObject* changedBy,
  166.                               TDependencySpace* dependencySpace);
  167. };
  168.  
  169. /***********************************|****************************************/
  170.  
  171. class TViewDateStatusInfo: public TViewMonitorStaticText
  172. {
  173.     virtual pascal void DoUpdate(ChangeID theChange, 
  174.                               TObject* changedObject,
  175.                               TObject* changedBy,
  176.                               TDependencySpace* dependencySpace);
  177.     virtual pascal DateForm GetDateFormat();
  178. };
  179.  
  180. /***********************************|****************************************/
  181.  
  182. class TViewlongDateStatusInfo: public TViewDateStatusInfo
  183. {
  184.     virtual pascal DateForm GetDateFormat();
  185. };
  186.  
  187. /***********************************|****************************************/
  188.  
  189. class TViewshortDateStatusInfo: public TViewDateStatusInfo
  190. {
  191.     virtual pascal DateForm GetDateFormat();
  192. };
  193.  
  194. /***********************************|****************************************/
  195.  
  196. class TViewabbrevDateStatusInfo: public TViewDateStatusInfo
  197. {
  198.     virtual pascal DateForm GetDateFormat();
  199. };
  200.  
  201. /***********************************|****************************************/
  202.  
  203. class TViewlogStatusInfo : public TTextListView
  204.  
  205. {
  206.     virtual pascal void Initialize(); 
  207.  
  208.     virtual pascal void IRes(TDocument* itsDocument,
  209.                         TView* itsSuperView,
  210.                         TStream* itsParams);
  211.                     
  212.     pascal void DoPostCreate(TDocument* itsDocument);
  213.  
  214.                 
  215.     virtual pascal void DoUpdate(ChangeID theChange, 
  216.                               TObject* changedObject,
  217.                               TObject* changedBy,
  218.                               TDependencySpace* dependencySpace);
  219.                               
  220.     virtual pascal void    GetItemText(short,
  221.                             CStr255&);
  222.     virtual pascal void    Free();
  223.     
  224.     public:
  225.         pascal void AddToLog(CStr255 theText);
  226.     protected:
  227.         TDynamicArray* fTextList;
  228. };
  229.  
  230.  
  231.  
  232. /***********************************|****************************************
  233.  *
  234.  *    This class implements a filled-status-bar, like the Appleshare 3.0
  235.  *    "CPU Usage" bar -- a rectangle which fills (current/(high-low))% of
  236.  *    the rectangle with black and the remainder with white.
  237.  *
  238.  ***********************************|****************************************/
  239.  
  240.  typedef struct StatusBarValuesRec {
  241.     unsigned long            low;
  242.     unsigned long            high;
  243.     unsigned long            current;
  244. } StatusBarValuesRec;
  245.  
  246. class TLeftFilledStatusBarView : public TView
  247. {
  248. public:
  249.     TLeftFilledStatusBarView();
  250.     virtual pascal void Draw(const VRect& area); //Override
  251.  
  252.  
  253.     virtual pascal void DoUpdate(ChangeID theChange,
  254.                                   TObject* changedObject,
  255.                                   TObject* changedBy,
  256.                                   TDependencySpace* dependencySpace); //Override
  257.  
  258. private:    StatusBarValuesRec        fStatusBarValues;
  259.  
  260. };
  261.  
  262. /***********************************|****************************************/
  263.  
  264. class TMonitorButton : public TButton
  265. {
  266.     virtual pascal void DoUpdate(ChangeID theChange, 
  267.                               TObject* changedObject,
  268.                               TObject* changedBy,
  269.                               TDependencySpace* dependencySpace);
  270.                               
  271.     virtual pascal void DoEvent(EventNumber eventNumber, TEventHandler* source,
  272.                                 TEvent* event); //Override
  273.  
  274. };
  275.  
  276. /***********************************|****************************************/
  277.  
  278. //----------------------------------------------------------------------------------------
  279. // Global initialization procedure
  280. //----------------------------------------------------------------------------------------
  281.  
  282. extern pascal void InitUViewStatusInfo();
  283.     // Call this routine at initialization time
  284.  
  285. //----------------------------------------------------------------------------------------
  286. // TIDList
  287. //----------------------------------------------------------------------------------------
  288.  
  289. /***********************************|****************************************/
  290.  
  291. class TStatusItemList : public TList
  292. {
  293.     virtual pascal CompareResult CompareElements(void* Element1, void* Element2);
  294. };
  295.  
  296. /***********************************|****************************************/
  297.  
  298. class TStatusItem : public TObject
  299. {
  300.     public:
  301.         TStatusItem();
  302.         
  303.         virtual pascal void SetID(IDType theID);
  304.         virtual pascal IDType GetID();
  305.                 
  306.         virtual pascal void SetDescType(IDType theID);
  307.         virtual pascal IDType GetDescType();
  308.                 
  309.         virtual pascal Boolean GetInfo(void* info, long& fInfoSize, DescType desiredType);
  310.         virtual pascal void SetInfo(void* info, long infoSize, DescType actualType);
  311.         
  312.         // Pass a null to set to no info
  313.         
  314.     private:    
  315.         IDType             fIdentifier;
  316.         DescType         fDataType;
  317.         Ptr             fData;
  318.         long            fDataSize;    
  319. };
  320.  
  321. /***********************************|****************************************/
  322.  
  323. class TFixedPopup : public TPopup
  324. {                
  325.     virtual pascal MenuHandle GetMenuHandle();
  326. };
  327.  
  328. /***********************************|****************************************/
  329.  
  330. class PascalObj TBulletTextBehavior;
  331.  
  332. class TBulletEditText : public TEditText
  333. {
  334. private:
  335.     CStringHandle fRealDataHandle;
  336.     TBulletTextBehavior* fBulletTextBehavior;
  337.  
  338. public:
  339.     virtual pascal void Initialize();    // Override 
  340.     
  341.     virtual pascal void Free();    // Override 
  342.     
  343.     virtual pascal TDialogTEView* GetTEView();    // Override 
  344.  
  345.     virtual pascal void ReleaseTEView();    // Override 
  346.  
  347.     virtual pascal void SetText(const CStr255& theText, Boolean redraw);    // Override 
  348.     
  349.     virtual pascal void StopEdit();    // Override 
  350.  
  351.     virtual pascal void AddCharacter(char ch);
  352.     
  353.     virtual pascal void GetRealText(CStr255& theText);
  354.     
  355.     virtual pascal void DelChars();
  356.     
  357. };
  358.  
  359. #endif
  360.